package com.atguigu.common.valid;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.List;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.ElementType.TYPE_USE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;




@Documented
@Constraint(validatedBy = {ListValConstraintValidator.class })//可以指定多个不同的校验器，校验器的类型可以自动适配
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
public @interface ListVal {

    /**
     * Author : hmy
     * @date 2021/6/26 17:59
     * desc : 自定义注解通过参考之前的注解
     *      1：添加相关自定义注解的依赖
     *
     *         <dependency>
     *             <groupId>javax.validation</groupId>
     *             <artifactId>validation-api</artifactId>
     *             <version>2.0.1.Final</version>
     *         </dependency>
     **/



    String message() default "{com.atguigu.common.valid.ListVal.message}";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

    int[] values() default {};

}
